<!DOCTYPE >
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>属性列表</title>


<link rel="stylesheet" type="text/css" href="/system/css/right.css">
<script type="text/javascript" src="/system/js/jquery.js"></script>
<script type="text/javascript" src="/system/js/system.js"></script>
<script type="text/javascript" src="/system/js/admin.js"></script>
<!-- 百度编辑器 -->
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.all.js"></script>
<!-- /百度编辑器 -->
<!-- 异步上传 -->
<script type="text/javascript" src="/system/js/ajaxfileupload.js" ></script>
<!-- /异步上传 -->

</head>
<body style="overflow: auto;">
	<div class="basic bor">
			<div class="title fl">当前位置：属性管理 > 品牌列表 > 型号列表</div>
	</div>
	<form action="{:url('Product/addsubclass')}"  enctype="multipart/form-data" method="post">
	<div class="addnav">
				<span class="navname">型号名称：</span>
				<input class="input127" type="text" name="name" >
				<span class="navname">型号ID：</span>
				<input class="input127" type="text" name="i" >
				<input class="input127" type="hidden" name="pid" value="{$pid}" >
		<span class="navname">上级菜单：</span>
				<select name="uid" id="uid">
					{volist name="list" id="li"}
					<option value="{$li.id}">{$li.html}{$li.n}</option>
					{/volist}
				</select>
				<input class="submit addnew" type="submit" value="添加" />
		</div>
	</form>


<!-- 文章分类列表 -->
<div class="catelist">
    <div class="lists listsov">
    <dd>属性列表</dd>
    </div>

</div>
<!-- /文章分类列表 -->
<table border="1"  class="table table-hover text-center" id='list'>
  <tr class="trcolor">
    <td>序号</td>
		<td>型号名称</td>
   	<td>单价</td>
		<td>车辆ID</td>
		<td>所属分类</td>
    <td>操作</td>
  </tr>
<!-- ============================================================= -->
{volist name="list" id="li" key="k"}
	<tr>
		<td>{$k}</td>
		<td>{$li.html}<input type="text" calss_name = "{$li.id}" onchange="upclass({$li.id})" name="" value="{$li.n}"  ></td>
	<td>
		{if condition="$li['p'] gt 0 "}
		<input type="text" calss_p = "{$li.id}" onchange="upclass({$li.id})" name="" value="{$li.p}" >  元
		{/if}
	</td>
		<td><input type="text" calss_i = "{$li.id}" onchange="upclass({$li.id})" name="" value="{$li.i}" > </td>
		<td>{$classname[$li.pid]} </td>
		<td><a href="{:url('Product/delsubclass', ['id' => $li['id']])}" class="current"  onclick="return confirm('确定将此记录删除?')" >删除</a></td>
	</tr>
{/volist}
<!-- ============================================================= -->
</table>
<script type="text/javascript">
//异步修改品牌名称
function upclass(id){
	n = $('[calss_name='+id+']').val();
	i = $('[calss_i='+id+']').val();
	p = $('[calss_p='+id+']').val();
		$.ajax({
				type:"post",                      //请求类型
				url:'{:url("Product/ajax_upsubclass")}',           //URL
				data:{n:n,i:i,id:id,p:p},   //传递的参数
				dataType:"json",                 //返回的数据类型
				success:function(data){          //data就是返回的json类型的数据
					alert(data.sutart);
				}
		});
}

</script>

<style>
.hide{
	display: hide;
}
</style>
</body>
</html>
